package models;

import java.util.List;
import java.util.Set;
import java.util.TreeSet;

import javax.persistence.CascadeType;
import javax.persistence.ManyToMany;
import javax.persistence.MappedSuperclass;

import siena.embed.Embedded;

abstract public class TaggableModel extends BasicModel {
		
	@Embedded
	public List<Tag> tags;

	public TaggableModel(String title) {
		super(title);

	}
	
	public TaggableModel() {
		super();

	}

	public void tag(String tag) {
		tags.add(Tag.findOrCreateByName(tag));
	}
	
	public void tag(String... tags) {
		for (String tag : tags) {
			tag(tag);
		}
	}
}
